<?

/**
 * @name StandardFramework Network HTTP Protocol
 * @author DENFER
 * @copyright DENFER STUDIO
 */

Class HTTPProtocol extends Protocol
{
    Public Function __construct()
    {
        IF($this->_SERVER->MaxDataLength < 1024)
            $this->_SERVER->MaxDataLength = 1024;
    }
    
    Public Function OnConnect(Connection $Connection)
    {
        
    }
    
    Public Function OnData(Connection $Connection, $Data)
    {
        $Headers = new HTTPHeaders;
        $Headers->Add("Contenth-type", "text/html");
        $Connection->
            Write($Headers->toString())->
            Write("Hello User" . rand(0,20000))->
            Close();
    }
    
    Public Function OnDisconnect(Connection $Connection)
    {
        
    }
    
    Public Function OnHTTP(Request $Request, Response $Response)
    {
        $Response->Text = json_encode($Request->URL);
    }
}